<?php
namespace App\Models;


/**
 * Model Student
 *
 * @property int $id
 * @property int $school_id
 * @property int $campus_id
 * @property string $student_name
 * @property int $sex
 * @property string $avatar
 * @property string $address
 * @property string $school_name
 * @property int $birthday
 * @property string $remark
 * @property int $status
 * @property string $created_at
 * @property string $updated_at
 * @property string $deleted_at
 *
 * @method static \Illuminate\Database\Query\Builder | \App\Models\Student where($column, $operator = null, $value = null, $boolean = 'and')
 * @method static \Illuminate\Database\Query\Builder | \App\Models\Student whereIn($column, $values, $boolean = 'and', $not = false)
 * @method static \Illuminate\Database\Query\Builder | \App\Models\Student leftJoin($table, $first, $operator = null, $second = null)
 * @method static \Illuminate\Database\Query\Builder | \App\Models\Student rightJoin($table, $first, $operator = null, $second = null)
 * @method static \Illuminate\Database\Query\Builder | \App\Models\Student get($columns = ['*'])
 * @method static \Illuminate\Database\Query\Builder | \App\Models\Student paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null)
 * @method static \Illuminate\Database\Query\Builder | \App\Models\Student find($id, $columns = ['*'])
 * @method static \Illuminate\Database\Query\Builder | \App\Models\Student first($columns = ['*'])
 * @method static \Illuminate\Database\Query\Builder | \App\Models\Student select($columns = ['*'])
 * @method static \Illuminate\Database\Query\Builder | \App\Models\Student orderBy($column, $direction = 'asc')
 * @package App\Model
 */
class Student extends BaseModel
{
    protected $table = 'student';

    public function studentCard(){
        return $this->hasMany(StudentCard::class);
    }

    public function class(){
        return $this->belongsToMany(Classs::class, 'class_member', 'student_id', 'class_id');
    }

    public function cards(){
        return $this->belongsToMany(Card::class, 'student_card', 'student_id', 'card_type_id');
    }

}
